package com.ticket.controller.api;

import com.ticket.entity.VenueSection;
import com.ticket.service.IVenueSectionService;
import com.ticket.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/venue-sections")
public class VenueSectionController {

    @Autowired
    private IVenueSectionService venueSectionService;

    @GetMapping("/{id}")
    public Result<VenueSection> getSectionById(@PathVariable Long id) {
        VenueSection section = venueSectionService.getById(id);
        if (section == null) {
            return Result.error("区域不存在");
        }
        return Result.success(section);
    }

    @GetMapping("/venue/{venueId}")
    public Result<List<VenueSection>> getSectionsByVenueId(@PathVariable Long venueId) {
        List<VenueSection> sections = venueSectionService.getSectionsByVenueId(venueId);
        return Result.success(sections);
    }
} 